package com.zy.ioc.pro1;

import com.zy.ioc.pro1.bean.BankDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @program: mavenTest153
 * @description: 面向接口的类的实例的托管
 * @author: zy
 * @create: 2025-07-12 15:34
 */
public class App4_annotation_interface {
    public static void main(String[] args) {
        //1.创建容器对象
       ApplicationContext context=  new AnnotationConfigApplicationContext(AppConfig.class);
       //父类引用指向子类对象
       BankDao bd= (BankDao) context.getBean("bankMysqlDao");
       bd.deposite();

       //复用了实例名称，但是指向的是不同的对象
      bd= (BankDao) context.getBean("bankOracleDao");
      bd.deposite();
    }
}
